package xyz.xtt.exchange.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import xyz.xtt.exchange.service.impl.TblAssetServiceImpl;
import xyz.xtt.exchange.utils.ApiResult;
import xyz.xtt.exchange.vo.AssetDetailsVo;
import xyz.xtt.exchange.vo.AssetTradeRecordVo;
import xyz.xtt.exchange.vo.AssetVo;

/**
 * This is Description &#064;author gzm &#064;date 2024/10/23/
 */
@RequestMapping("/api/exchange")
@RestController
public class JoinController {
	@Autowired
	private TblAssetServiceImpl assetService;

	/**
	 * 获取个人资产列表、支持条件查询 一级分类：firstType 二级分类：secondType
	 */
	@GetMapping("/query/leftjoin")
	public ApiResult<AssetVo> queryLeftJoin(Long assetId) {
		AssetVo queryAssetVo = assetService.queryAssetVo(assetId);
		return ApiResult.ok(queryAssetVo);
	}

	@GetMapping("/query/page")
	public ApiResult<List<AssetVo>> queryPage(String uid) {
		List<AssetVo> queryAssetVo = assetService.queryAssetVoPage(uid);
		return ApiResult.ok(queryAssetVo);
	}

	@GetMapping("/query/sub")
	public ApiResult<List<AssetVo>> querySub(String uid) {
		List<AssetVo> queryAssetVo = assetService.subqueryAssetVoPage(uid);
		return ApiResult.ok(queryAssetVo);
	}

	@GetMapping("/query/from")
	public ApiResult<List<AssetVo>> queryFrom(String uid, Integer curPage) {
		List<AssetVo> queryAssetVo = assetService.fromqueryAssetVoPage(uid, curPage);
		return ApiResult.ok(queryAssetVo);
	}

	@GetMapping("/query/self")
	public ApiResult<List<AssetTradeRecordVo>> querySelf(String goodsId) {
		List<AssetTradeRecordVo> queryAssetVo = assetService.queryAssetTradeRecord(goodsId);
		return ApiResult.ok(queryAssetVo);
	}

	@GetMapping("/query/queryDetail")
	public ApiResult<AssetDetailsVo> queryDetail(String goodsId) {
		AssetDetailsVo queryAssetVo = assetService.queryDetail(goodsId);
		return ApiResult.ok(queryAssetVo);
	}

	@GetMapping("/query/queryBuyerChainAccount")
	public ApiResult<List<String>> queryBuyerChainAccount(String goodsId) {
		List<String> queryAssetVo = assetService.queryBuyerChainAccount(goodsId);
		return ApiResult.ok(queryAssetVo);
	}

}